<script type="text/javascript">
    var ROOT = '{$APP_ROOT}/{$URL_NAME}';
    var VAR_MODULE = "m";
    var VAR_ACTION = "a";
    var WEB_SESSION_ID = '<?php echo es_session::id(); ?>';
    var EMOT_URL = '{$APP_ROOT}/public/emoticons/';
    var MAX_FILE_SIZE =  '5120000b';
    var UPLOAD_URL ='{$APP_ROOT}/m.php?m=PublicFile&a=do_upload&upload_type=1&dir=image';
    var UPLOAD_SWF='{$TMPL}/js/plupload/Moxie.swf';
    var UPLOAD_XAP='{$TMPL}/js/plupload/Moxie.xap';
    var ALLOW_IMAGE_EXT= "gif,jpg,jpeg,png,bmp";
    var MAX_IMAGE_SIZE= '5120000b';
    var max_size = MAX_IMAGE_SIZE;
    max_size  = max_size.substr(0, max_size.length - 1);
    var max_size = parseInt(max_size)/1024/1000+'M';
    function get_file_fun(name){
        var loading;
        $("#"+name).ui_upload({
            multi:false,
            FilesAdded:function(){
                loading = layer.load();
            },
            FileUploaded:function(ajaxobj){
                if(ajaxobj.state==200) {
                    $("#"+name+"-url").val(ajaxobj.fullname);
                    $("#"+name+"-image").attr('src',ajaxobj.fullname);
                }else{
                    layer.msg(ajaxobj.message);
                }
                layer.close(loading);
            },Error:function(error){
                if(error.code==-600){
                    layer.msg("您上传的文件太大，最大允许上传"+max_size);
                }else{
                    layer.msg(error.message);
                }
                layer.close(loading);
            }
        });
    }
</script>